package ar.com.sudoku.rules;

import java.util.ArrayList;
import java.util.List;

import ar.com.sudoku.model.SudokuNumber;
import ar.com.sudoku.model.Grid;

public class LeftDiagonalRule implements Rule {

	@Override
	public boolean apply(Grid grid) {
		List<SudokuNumber> diagonal = new ArrayList<SudokuNumber>();
		for (SudokuNumber x : SudokuNumber.values()) {
			if (grid.get(x,x) == null) {
				continue;
			}
			if (diagonal.contains(grid.get(x,x))) {
				return false;
			} else  {
				diagonal.add(grid.get(x,x));
			}
		}
		return true;
	}

}
